package com.lionli.netty.demo.rpc.customer;

import com.lionli.netty.demo.rpc.netty.NettyClient;
import com.lionli.netty.demo.rpc.service.HelloService;

/**
 * 消费端启动类
 *
 * @author LionLi
 */
public class ClientBootstrap {
    // 协议头
    public static final String providerName = "HelloService#hello#";

    public static void main(String[] args) throws  Exception{
        NettyClient customer = new NettyClient();
        // 创建代理对象
        HelloService service = (HelloService) customer.getBean(HelloService.class, providerName);
        while(true) {
            Thread.sleep(2 * 1000);
            // 通过代理对象调用服务提供者的方法
            String res = service.hello("你好服务端");
            System.out.println("结果 => " + res);
        }
    }
}
